﻿using LDM.Framework.Application;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LDM.Framework.WebApiClientCore
{
    public interface IConsulProvider : IScoped
    {
        string SelectServiceUri(string serviceName);
    }

    /// <summary>
    /// 使用Consul配置进行Uri获取
    /// </summary>
    public class ConsulProvider : IConsulProvider
    {
        public string SelectServiceUri(string serviceName)
        {
            //TODO:后续改造为根据consul动态获取Uri
            return App.Configuration[$"{serviceName}:HttpHost"];
        }
    }
}
